function EntityManagement() {
    var entityManagementSelf = this;
    this.entityName = "";
    this.entityPath = "";
    this.entityTable = "management";

    this.refresh = function () {
        $("#" + entityManagementSelf.entityTable).flexReload();
    }

    //新增
    this.add = function (com, grid) {
        return top.qBox.iFLoad({title:'新增' + entityManagementSelf.entityName, src:ctx + entityManagementSelf.entityPath + "/input.action", afterHide:entityManagementSelf.refresh});
    }

    //修改
    this.edit = function (com, grid) {
        if (BossUtils.checkSingleRecord(com, grid)) {
            row_id = BossUtils.getCurrentRecord(com, grid);
            top.qBox.iFLoad({title:'修改' + entityManagementSelf.entityName, src:ctx + entityManagementSelf.entityPath + "/input.action?id=" + row_id, afterHide:entityManagementSelf.refresh});
        }
    }

    //确认删除
    this.confirmDel = function (com, grid) {
        if (BossUtils.checkSingleRecord(com, grid)) {
            row_id = BossUtils.getCurrentRecord(com, grid);
            top.Boxy.confirm("确认: 删除" + entityManagementSelf.entityName + "<span style='color: red'>" + row_id + "</span>", function () {
                entityManagementSelf.del(com, grid);
            }, {title:"确认信息"});
            return false;
        }
    }

    //删除
    this.del = function (com, grid) {
        if (BossUtils.checkSingleRecord(com, grid)) {
            row_id = BossUtils.getCurrentRecord(com, grid);
            jQuery.ajax({
                url:ctx + entityManagementSelf.entityPath +  '/delete.action?id=' + row_id + '&t=' + new Date().getTime(),
                type:"GET",
                success:function (data) {
                    var ret = eval('(' + data + ')');
                    var message = "删除" + entityManagementSelf.entityName + "<span style='color: red'>" + row_id + "</span>：" + ret.message;
                    top.Boxy.alert(message, null, {title:"提示信息"});

                    if (ret.code == 'A00000') {
                        entityManagementSelf.refresh();
                    }
                }
            })
        }
    }

    //确认批量下线
    this.confirmUgcVideoBatchOffline = function (com, grid) {
        if (BossUtils.checkSingleRecord(com, grid)) {
            row_id = BossUtils.getCurrentRecord(com, grid);
            top.Boxy.confirm("确认: 下线" + entityManagementSelf.entityName + "<span style='color: red'>" + row_id + "</span>", function () {
                entityManagementSelf.ugcVideoBatchOffline(com, grid);
            }, {title:"确认信息"});
            return false;
        }
    }

    //批量下线
    this.ugcVideoBatchOffline = function (com, grid) {
        if (BossUtils.checkSingleRecord(com, grid)) {
            row_id = BossUtils.getCurrentRecord(com, grid);
            jQuery.ajax({
                url:ctx + entityManagementSelf.entityPath +  '/offline.action?videoUgcId=' + row_id + '&t=' + new Date().getTime(),
                type:"GET",
                success:function (data) {
                    var ret = eval('(' + data + ')');
                    var message = "下线" + entityManagementSelf.entityName + "<span style='color: red'>" + row_id + "</span>：" + ret.message;
                    top.Boxy.alert(message, null, {title:"提示信息"});

                    if (ret.code == 'A00000') {
                        entityManagementSelf.refresh();
                    }
                }
            })
        }
    }
};
